<template>
	<view>
		<view>
			<view style="margin-top:80upx">
				<view v-for="(item,index) in leaveArr" :key="index">
					<view v-if="index%2" class="indexTeacher" @click="leaveIndexSkip(item)">
						<view style="margin-left:60upx">
							{{item.className}}
						</view>
						<view style="margin-right:20upx; font-size:24upx">
							{{item.classroom || ''}} >
						</view>
					</view>
					<view v-else class="indexTeacher0" @click="leaveIndexSkip(item)">
						<view style="margin-left:60upx">
							{{item.className}}
						</view>
						<view style="margin-right:20upx; font-size:24upx">
							{{item.classroom || ''}} >
						</view>
					</view>

				</view>
			</view>
			<view class="logoSty"></view>
		</view>
	</view>
</template>

<script>
	import topCom from '../component/topCom.vue'
	import bottomCom from '../component/bottom.vue'
	import headTitle from '../component/btnHeadeCom.vue'
	export default {
		name: 'leveRegistration',
		data() {
			return {
				identity: "", // 身份
				bzrUrl: "/pages/index/index", // 班主任头部返回按钮的url
				Attbottoms: [{
						name: 'home',
						icon: 'iconfont icon-yonghutongji',
						text: "首页",
						path: '/pages/index/index'
					},

					{
						name: 'maintenance',
						icon: 'iconfont icon-shezhi',
						text: "退出",
						path: '/pages/index/login'
					},
				],
				userName: '',
				topName: '报修登记',
				id: '',
				leaveArr: [{
					icon: '',
					className: 'Y34',
					classroom: '明智楼201'
				}, {
					icon: '',
					className: 'Y36',
					classroom: '明智楼211'
				}, {
					icon: '',
					className: 'Y38',
					classroom: '明智楼212'
				}, {
					icon: '',
					className: 'Y40',
					classroom: '明智楼221'
				}, ]
			}
		},
		components: {
			topCom,
			bottomCom,
			headTitle
		},
		onShow() {
			var that = this
			uni.getStorage({
				key: "loginName",
				success: (res) => {
					that.userName = res.data
				}
			})
			uni.getStorage({
				key: "loginId",
				success: (res) => {
					that.id = res.data
				}
			})
		},
		mounted() {
			this.getClassData()
			this.identity = uni.getStorageSync("userInfo")
		},
		methods: {
			// 获取班级列表
			getClassData() {
				this.$api.teacher.tecClassList(this.id).then(res => {
					this.leaveArr = res.data
					// this.leaveArr.forEach(item => {
					//  item.isShow = false
					//     item.type=1
					//  })	
				}).catch(e => {})
			},
			leaveIndexSkip(item) {
				uni.navigateTo({
					url: `/pages/maintenance/maintenanceStatus?classId=${item.classId}&className=${item.className}`,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		}
	}
</script>

<style>
	.indexTeacher {
		margin: auto;
		margin-top: 40upx;
		width: 605upx;
		height: 72upx;
		display: flex;
		justify-content: space-between;
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/T-4.png);
		background-size: 100%;
		color: white;
		padding-top: 30upx;
		font-size: 38rpx;
		/* opacity: 0.8; */
	}

	.indexTeacher0 {
		margin: auto;
		margin-top: 40upx;
		width: 605upx;
		height: 72upx;
		display: flex;
		justify-content: space-between;
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/T-6.png);
		background-size: 100%;
		color: white;
		padding-top: 30upx;
		font-size: 38rpx;
		/* opacity: 0.8; */
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
</style>